var Input = require('../../../src/libs/input');

var Button = React.createClass({
		getDefaultProps:function(){
			return {
				test:'aaa'
			}
		},
		render: function() {
			return <input type="button" value={this.props.test} onclick={this.props.onclick}/>
		}
});

var Root = React.createClass({
		test:function(){
			return 'dddfdfdf';
		},
		handler: function() {
			this.refs.a.innerText = 'ssdddd';
			this.refs.b.handler();
			console.log(this.refs.b);
		},
		handler1:function(){
			alert(window.PageDM.input2.getValue());
		},
		render: function() {
			var PageDM = window.PageDM;
			return <div>
							<span ref="a"></span>
							<input type="text" id={PageDM.input1.id} name={PageDM.input1.name} value={PageDM.input1.value} dmbind={PageDM.input1.dmbind}/>
							<Input/>
							<Input ref="b" id={PageDM.input2.id} name={PageDM.input2.name} value={PageDM.input2.value} dmbind={PageDM.input2.dmbind}/>
							<Button test="设值" id={PageDM.btn1.id} name={PageDM.btn1.name} onclick={PageDM.btn1.click}/>
							<Button test="取值" onclick={PageDM.btn2.click}/>
							<Button test="测试" onclick={this.handler.bind(this)}/>
							<Button test="测试2" onclick={this.handler1}/>
						</div>
		}
});
ReactDOM.render(<Root/>, document.getElementById('main'));